from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt, QString

class TartBarName(QtGui.QWidget):
        def __init__(self, *args, **kw):
		QtGui.QWidget.__init__(self, *args, **kw)
		self.setGeometry(0, 0, 323, 40)

                self.row = -1
                self.girl = None

#
#               background image
#
		bg = QtGui.QLabel(self) 
		bg.setGeometry(0, 0, 233, 40)
		path = "resources/tart_bar_name.png"
		bg.setPixmap(QtGui.QPixmap(path))

#
#               text display. we're using Times New Roman
#               to get a "printed" look
#
		text = QtGui.QLabel(self) 
		text.setGeometry(10, 4, 220, 32)
		font = QtGui.QFont("Times New Roman", 14)
		text.setFont(font)
		text.setText("")
		self.text = text

#
#       set the name displayed by the widget
#
	def set_text(self, s):
		self.text.setText(s)

        def set_girl(girl):
		self.girl = girl
		self.set_text(girl.name) 

#
#       we need signals for clicked and doubleclicked
#       I could use a button for this, but I don't want it
#       to behave like a button - just to register clicks
#
        clicked = QtCore.pyqtSignal()
        doubleclicked = QtCore.pyqtSignal()

	def mousePressEvent(self, sender):
		self.clicked.emit()
	def mouseDoubleClickEvent(self, sender):
		self.doubleclicked.emit()

if __name__ == "__main__":
	import sys

	app = QtGui.QApplication(sys.argv)

	top = QtGui.QLabel()
	top.setGeometry(0, 0, 300, 100)
	path = "resources/wood.jpg"
	top.setPixmap(QtGui.QPixmap(path))

	screen = TartBarName(top)
	screen.move(20,20)
	screen.set_text("hello")

	def m1():
		print "wheee"
	def m2():
		print "whooo"
	screen.clicked.connect(m1)
	screen.doubleclicked.connect(m2)

	top.show()
	sys.exit(app.exec_())


